//
//  HSYBaseNavigationController.m
//  HSY
//
//  Created by 陈浩 on 2017/4/1.
//  Copyright © 2017年 金开门. All rights reserved.
//

#import "HSYBaseNavigationController.h"
#import "HSYBaseNavigationBar.h"

@interface HSYBaseNavigationController ()<UIGestureRecognizerDelegate>

@end

@implementation HSYBaseNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.interactivePopGestureRecognizer.delegate = self;

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark  UIGestureRecognizerDelegate

//根视图控制器禁用侧滑手势
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{
    if (gestureRecognizer == self.interactivePopGestureRecognizer && self.childViewControllers.count <= 1) {
        return NO;
    } 
    return YES;
}

+ (instancetype)navigtationControllerWithRootViewController:(UIViewController *)rootViewController{
    HSYBaseNavigationController *navVC = [[HSYBaseNavigationController alloc] initWithRootViewController:rootViewController];
    
    HSYBaseNavigationBar *bar = [[HSYBaseNavigationBar alloc] init];
    [navVC setValue:bar forKey:@"navigationBar"];
    
    return navVC;

}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
